import service from '@/utils/request'

// 获取角色列表
export const getRoleList = (params) => {
  return service({
    url: '/sys/role',
    params // 查询参数
  })
}
// 获取角色详情
export const getRoleDetail = id => {
  return service({
    url: `/sys/role/${id}`
  })
}
// 新增角色
export const addRole = data => {
  return service({
    url: '/sys/role',
    method: 'post',
    data
  })
}
// 更新角色
export const updateRole = data => {
  return service({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}
// 删除角色
export const delRole = id => {
  return service({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 给角色分配权限
export const assignPerm = (data) => {
  return service({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
